package 反转链表;

public class Soulution2 {
    // 双指针法
    public ListNode reverseList(ListNode head) {

        if ( head ==null || head.next == null ){
            return head;
        }

        ListNode pre = head.next;
        ListNode post = pre.next;
        head.next = null;
        while ( pre != null ){
            pre.next = head;
            head = pre;
            pre = post;
            if( post != null )
                post = post.next;
        }
        return head;
    }
}
